<!--<script src="<?php echo $base_url?>static/dist/js/lib/store.legacy.min.js"></script>-->
<script>
    $(function () {
    // var cartData = store.get('cartData') || [];
    var cartData = getCookie('cartData') || [];
        if(cartData.length != 0){           
                fillCart();             
            }

            function fillCart() {
                var htmlStr = '';
                var sum = 0, num = 0;
                for (var i = 0; i < cartData.length; i++) {
                    num = parseInt(cartData[i].quantity) || 0;
                    if (num) {
                        sum += num;
                    }
                }
                if (sum >= 100) {
                    sum = '99+'
                }
					 
				
				if(sum == 0){
					 $('.shop-car').find('.num').addClass('none');
					 
					 return;
				}
				
                htmlStr = '<div class="num">' + sum + '</div>';
                $numEl = $('.shop-car .num');
                if ($numEl.length == 0) {
                    $('.shop-car').append(htmlStr)
                } else {
                    $numEl.html(sum)
                }
            }
        })


		function setCookie(cname, cvalue, exdays) {
			cvalue = JSON.stringify(cvalue)

			var d = new Date();
			d.setTime(d.getTime() + (exdays*60*60*1000));
			var expires = "expires="+d.toUTCString();
			document.cookie = cname + "=" + cvalue + "; " + expires + ";path=/";  
		}
        function getCookie(cname) {
			var name = cname + "=";
			var ca = document.cookie.split(';');
			for(var i=0; i<ca.length; i++) {
				var c = ca[i];
				while (c.charAt(0)==' ') c = c.substring(1);
				if (c.indexOf(name) != -1){
					return JSON.parse(c.substring(name.length, c.length));
				} 
			}
			return "";
		}
    </script>
